Operation Has Suspicious Side Effects (OHSSE)

Description:

OHSSE detects if both sides of a binary expression, or an assignment expression change the value of the same variable. This may cause undesirable program behavior under some circumstances.

OHSSE supports three levels that you can specify in the audit's properties:

  1. Detect only update conflicts. If the variable is updated more than once in one expression, the audit violation is reported.
  2. In addition to update conflicts, the audit violation is reported if the variable is accessed after having been postincremented or postdecremented in the same expression. This level of reporting is selected by default.
  3. The audit violation is reported when the variable is updated and accessed in the same expression.

Incorrect:

void search(int x[], int n) {
    int i = 0;
    while (i < n) {
        if (x[i++] == x[i++]) {
            ...
        }
    }
}

Correct:

void search(int x[], int n) {
    int i = 0;
    while (i < n) {
        if (x[i] == x[i + 1]) {
            ...
        }
        i += 2;
    }
}